<form id="grade-form" lay-filter="grade-form" class="layui-form model-form">
    <div class="layui-form-item">
        <label class="layui-form-label">分数</label>
        <div class="layui-input-inline">
            <input name="score" placeholder="请打分" type="number" class="layui-input" lay-verify="required" required/>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">评价或建议</label>
        <div class="layui-input-block">
            <textarea id="advise-edit" name="advise" class="layui-textarea"  placeholder="评价或建议"></textarea>
        </div>
    </div>
    <div class="layui-form-item model-form-footer">
        <button class="layui-btn layui-btn-primary" ew-event="closeDialog" type="button">取消</button>
        <button class="layui-btn" lay-filter="grade-form-submit" lay-submit>保存</button>
    </div>
</form>

<script>
    layui.use(['layedit', 'form', 'config', 'admin', 'layer'], function () {
        var form=layui.form;
        var layer=layui.layer;
        var layedit=layui.layedit;
        var admin=layui.admin;
        //富文本框
        var adviseEdit = layedit.build('advise-edit',{
            height:180
        });
        let lepcid = admin.getTempData("learn_lepcid");
        let stcode = admin.getTempData("learn_stcode");
        let userid = admin.getTempData("learn_userid");
        // 表单提交事件
        form.on('submit(grade-form-submit)', function (data) {
            let res = data.field;
            res.lepcid=lepcid;
            res.stcode=stcode;
            res.userid=userid;
            res.advise = layedit.getContent(adviseEdit);
            console.log(res);
            admin.req('api-study/learnRate/update', JSON.stringify(res), function (data) {
                if (data.code == 0) {
                    layer.msg(data.msg, {icon: 1, time: 500});
                    admin.finishPopupCenter();
                } else {
                    layer.msg(data.msg, {icon: 2, time: 500});
                }
            },'POST');
            return false;
        });

    })
</script>